package cn.wolfcode.mq;

import cn.wolfcode.web.controller.OrderInfoController;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        topic = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC,
        consumerGroup = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC + "_CHANGE_SIGN_CUSTOMER_GROUP",
        messageModel = MessageModel.BROADCASTING    // 广播模式: 所有本地标识都要修改
)
public class MQOrderChangeSignListener implements RocketMQListener<Long> {

    /**
     * 监听消息, 修改本地标识
     * @param seckillId
     */
    @Override
    public void onMessage(Long seckillId) {
        OrderInfoController.stockCountMap.put(seckillId, false);
    }
}
